<?php
/**
 * 描述：会员管理中心-关闭订单。
 * @final
 */
final class Exec_MC_Transaction_Seller_Ordersheet_Close extends Exec_MC_Master
{
    public function Get()
    {
        #获取参数
        $orderNumber=Functions::UrlArgs('ordernumber');
        
        #检查状态
        $data=DB::PGetRows('select * from ordersheet where OrderNumber=?',array(
            $orderNumber
        ));
        if($data)
        {
            if($data[0]['Model']=='SERVICE')
            {
                $tmp=DB::PGetRows('select * from ordersheet_extend_service where OrderNumber=?',array(
                    $orderNumber
                ));
                if($tmp)
                {
                    if($tmp[0]['Status']!='SERVICE::000')
                    {
                        echo 'error';
                        return;
                    }
                }
                else
                {
                    echo 'no';
                    return;
                }
            }
            else
            {
                echo 'nothing';
                return;
            }
        }
        else
        {
            echo 'none';
            return;
        }

        #输入结果
        View::Assign('OrderNumber',$orderNumber);
        $this->MasterPage_Display(View::Fetch('mc/transaction/seller/ordersheet/close.tpl'));
    }

    public function  Post()
    {
        #获取参数
        $orderNumber=Functions::FormArgs('OrderNumber');

        #更新数据
        DB::PExec('update ordersheet_extend_service set Status=? where OrderNumber=?',array
        (
            'SERVICE::999',
            $orderNumber
        ));

        #输入结果
        echo 'Success';
    }
}
?>